//
//  UIImage+CRKit.m
//  TestPrj
//
//  Created by 朱铅峰 on 2020/8/3.
//  Copyright © 2020 Xing. All rights reserved.
//

#import "UIImage+CRKit.h"
#import "CRKit.h"

@implementation UIImage (CRKit)

/// 图片资源
/// @param imageName 名称
+ (UIImage *)cr_imageInKit:(NSString *)imageName {
    
    NSBundle *bundle = [[CRKit sharedKit] resourceBundle];
    UIImage *image = [UIImage imageNamed:imageName inBundle:bundle compatibleWithTraitCollection:nil];
    if (!image) {
        image = [UIImage imageNamed:imageName];
    }
    return image;
}

/// 表情资源
/// @param imageName 名称
+ (UIImage *)cr_emoticonInKit:(NSString *)imageName {
    
    NSBundle *bundle = [[CRKit sharedKit] emoticonBundle];
    
    NSString *name = [@"Emoji" stringByAppendingPathComponent:imageName];
    UIImage *image = [UIImage imageNamed:name inBundle:bundle compatibleWithTraitCollection:nil];
    if (!image) {
        image = [UIImage imageNamed:imageName];
    }
    return image;
}

@end
